<?php
require_once('meekrodb.2.3.class.php');

if(!empty($_POST)) {
	$data = json_decode($_POST['cities']);
	$stateId = $_POST['stateId'];
	$countryCode = $_POST['countryCode'];
	$cities = array();
	foreach($data as $key => $value) {
		$cities[] = array(
			'country_code' => $countryCode,
			'state_id' => $stateId,
			'city_id' => $value[0],
			'city_name' => $value[1]
		);
	}
	
	DB::insert('cities', $cities);
}